import { useLoaderData, Outlet } from "react-router-dom";
import { useEffect, useState } from "react";
import axios from "axios";
export default function project() {
  const data = useLoaderData();
  const [name, setName] = useState("");
  useEffect(() => {
    axios.get("/api/delayUser/123").then((res) => {
      setName(res.data.name);
    });
  });
  return (
    <div>
      <h1>路由加载{data.name}</h1>
      <h1>传统加载{name}</h1>
      <Outlet />
    </div>
  );
}
